package cn.edu.xmu.javaee.productdemomybatis.mapper.generator;

import cn.edu.xmu.javaee.productdemomybatis.mapper.generator.po.GoodsPo;
import cn.edu.xmu.javaee.productdemomybatis.mapper.generator.po.GoodsPoExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface GoodsPoMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_goods
     *
     * @mbg.generated
     */
    @DeleteProvider(type=GoodsPoSqlProvider.class, method="deleteByExample")
    int deleteByExample(GoodsPoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_goods
     *
     * @mbg.generated
     */
    @Delete({
        "delete from goods_goods",
        "where `id` = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_goods
     *
     * @mbg.generated
     */
    @Insert({
        "insert into goods_goods (`product_id`, `relate_product_id`, ",
        "`creator`, `gmt_create`, ",
        "`modifier`, `gmt_modified`)",
        "values (#{productId,jdbcType=INTEGER}, #{relateProductId,jdbcType=INTEGER}, ",
        "#{creator,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, ",
        "#{modifier,jdbcType=VARCHAR}, #{gmtModified,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(GoodsPo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_goods
     *
     * @mbg.generated
     */
    @InsertProvider(type=GoodsPoSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insertSelective(GoodsPo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_goods
     *
     * @mbg.generated
     */
    @SelectProvider(type=GoodsPoSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="product_id", property="productId", jdbcType=JdbcType.INTEGER),
        @Result(column="relate_product_id", property="relateProductId", jdbcType=JdbcType.INTEGER),
        @Result(column="creator", property="creator", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="modifier", property="modifier", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP)
    })
    List<GoodsPo> selectByExample(GoodsPoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_goods
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "`id`, `product_id`, `relate_product_id`, `creator`, `gmt_create`, `modifier`, ",
        "`gmt_modified`",
        "from goods_goods",
        "where `id` = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="product_id", property="productId", jdbcType=JdbcType.INTEGER),
        @Result(column="relate_product_id", property="relateProductId", jdbcType=JdbcType.INTEGER),
        @Result(column="creator", property="creator", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="modifier", property="modifier", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP)
    })
    GoodsPo selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_goods
     *
     * @mbg.generated
     */
    @UpdateProvider(type=GoodsPoSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("row") GoodsPo row, @Param("example") GoodsPoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_goods
     *
     * @mbg.generated
     */
    @UpdateProvider(type=GoodsPoSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("row") GoodsPo row, @Param("example") GoodsPoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_goods
     *
     * @mbg.generated
     */
    @UpdateProvider(type=GoodsPoSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(GoodsPo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_goods
     *
     * @mbg.generated
     */
    @Update({
        "update goods_goods",
        "set `product_id` = #{productId,jdbcType=INTEGER},",
          "`relate_product_id` = #{relateProductId,jdbcType=INTEGER},",
          "`creator` = #{creator,jdbcType=VARCHAR},",
          "`gmt_create` = #{gmtCreate,jdbcType=TIMESTAMP},",
          "`modifier` = #{modifier,jdbcType=VARCHAR},",
          "`gmt_modified` = #{gmtModified,jdbcType=TIMESTAMP}",
        "where `id` = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(GoodsPo row);
}